package com.kizuki;

import com.kizuki.bo.ConsturctBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

/**
 * SpringBoot在没配置@ComponentScan的情况下，默认只扫描和主类处于同包下的Class
 * 如果需要jar包的bean，且jar包目录层级与当前主类不一致需要@ComponentScan
 * 当添加 @EnableAspectJAutoProxy 时，使用的是 AnnotationAwareAspectJAutoProxyCreator 来产生 AOP 代理类。/增强
 * 不添加 @EnableAspectJAutoProxy 时，使用的是 InfrastructureAdvisorAutoProxyCreator 来产生 AOP 代理类。
 */
@SpringBootApplication
@EnableScheduling
@EnableAsync
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class AnnotationApplication {

    @Autowired
    private ConsturctBean consturctBean;

    public static void main(String[] args) {
        SpringApplication.run(AnnotationApplication.class, args);
    }

    @Bean
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}
